from celery import Celery


password = "foobared"
app = Celery(
    'tasks', 
    broker=f'redis://:{password}@192.168.2.172:6379/0', 
    backend=f'redis://:{password}@192.168.2.172:6379/1'
    )


def test():
    qhdm,sdate,edate,cloud = '41','2024-03-01','2024-04-01',100
    cargs = {
        "database":"henan_rsanalysis",
        "user":"postgres",
        "password":"postgresql",
        "host":"192.168.1.71", 
        "port":"5432"
    }
    agent = {"ip":"192.168.2.172","port":"10809"}
    # result = tasks.searcher.province_2_pgtable(qhdm,sdate,edate,cloud,cargs,agent)
    # result = app.searcher.province_2_pgtable.delay(qhdm,sdate,edate,cloud,cargs,agent)
    app.send_task(
        'coperni.searcher.province_2_pgtable', 
        args=[qhdm,sdate,edate,cloud,cargs,agent])
    return


if __name__ == "__main__":
    test()